//
//  Label.h
//  Prism
//
//  Created by Bas du Pre on 24-05-11.
//  Copyright 2011 UU. All rights reserved.
//

#pragma once

#include "Node.h"
#include "Color.h"

namespace Prism {
namespace Graphics {
    
    /// \todo Multiline labels: http://www.cocos2d-iphone.org/wiki/doku.php/tips:multiline_label
    class Label : public Node {        
    public:
        enum Quality {
            QualityHigh, QualitySpeed
        };
        
        ///\todo Error if the font does not exist
        
        Label();
        Label(const String & value);
        Label(const String & text, const String & font);
        Label(const String & text, const String & font, PFloat size);
        Label(const String & text, const String & font, PFloat size, const Color & color);
        Label(const String & text, const String & font, PFloat size, const Color & color, Quality quality);
        ~Label();
        
        void init();
        
        void native_loadLabel();
        
        void setValue(const String &value);
        String value();
        void setFont(const String & font);
        String font();
        void setQuality(Quality quality);
        Quality quality();
        void setSize(PFloat size);
        PFloat size();
        void setColor(const Color & color);
        Color &color();
        
        virtual Rect boundingBox();
        virtual String toString();
        
        Event<EventArgs*> onSizeChange;
        Event<EventArgs*> onValueChange;
        Event<EventArgs*> onFontChange;
        Event<EventArgs*> onQualityChange;
        Event<EventArgs*> onColorChange;
        
        #if PRISM_OS_IOS && PRISM_BUILDENGINE
        #include "iOS/ios_Label.h"
        #elif PRISM_TARGET_SDL
        #include "sdl/sdl_Label.h"
        #endif
        
    private:
        String _value;
        String _font;
        Quality _quality;
        PFloat _size;
        Color _color;
        
        void _onColorChangeHandler(void* sender, EventArgs* e);
        Rect native_boundingBox();
    };
}
}
